-- create inverted index for the exact match search query
CREATE TABLE words_boolean_index AS
SELECT id, lower(word) word FROM words NATURAL JOIN question
WHERE word ~* '^[a-z][a-z0-9_]+$'
AND tablename = 'posts' AND (what='title' OR what='body')
GROUP BY id,word;